	function FillForm(tablePrefix, spPrefix)
	{
		name = document.getElementById('name').value;
		plural_name = Pluralize(name);
		plural_name_uppercased = plural_name.toUpperCase();
		
		//model variables
		document.getElementById('system_name').value = plural_name;
		document.getElementById('table_name').value = tablePrefix + plural_name;
		document.getElementById('database_config').value = 'db_config_default';
		document.getElementById('stored_procedure_list').value = spPrefix + plural_name + '_list';
		document.getElementById('stored_procedure_list_paged').value = spPrefix + plural_name + '_list_paged';
		document.getElementById('stored_procedure_update').value = spPrefix + plural_name + '_update';
		document.getElementById('stored_procedure_get').value = spPrefix + plural_name + '_get';
		document.getElementById('stored_procedure_delete').value = spPrefix + plural_name + '_delete';
		document.getElementById('stored_procedure_insert').value = spPrefix + plural_name + '_insert';

		//controller variables
		document.getElementById('page_title').value = 'LANG_' + plural_name_uppercased;
		
		/* depricated: moved to PHP (SetDefaults) */
		//document.getElementById('layout').value = 'main';
		//document.getElementById('module').value = 'general';

		//document.getElementById('std_dir').focus();
	}
	
	//makes the name plural
	function Pluralize(word, amount)
	{
		var unpluralized = new Array("fish", "sheep", "deer")
		
		if (amount == 1) return word;
	
		for (var i=0; i < unpluralized.length; i++)
			if (unpluralized[i] == word)
				return word;
	
		if (word == "is") return "are";
			
		switch (word.substring(word.length-2, word.length))
		{
			case "sh": case "zz": case "ss":case "ch":
				return word+"es";
			case "ey": case "oy": case "ay":
				return word+"s";
		}
		switch (word.substring(word.length-1, word.length))
		{
			case "y":
				return word.substring(0, word.length-1)+"ies";
			case "s":
				return word.substring(0, word.length-1)+"ses";
			case "z":
				return word.substring(0, word.length-1)+"zes";
			case "x":
				return word.substring(0, word.length-1)+"xes";
			case "o":
				return word.substring(0, word.length-1)+"os";
//				return word.substring(0, word.length-1)+"oes";
		}
		return word+"s";
	}
		
	/*function Pluralize(name)
	{
		last_char = name.substr(-1);

		switch (last_char)
		{
			case 'y': plural_name = name.substr(0, name.length - 1) + 'ies'; break;
			case 's': plural_name = name + 'es'; break;
			default: plural_name = name + 's'; break;
		}

		return plural_name;
	}*/
	
	function changeSelectValue (roll_id, value)
	{
		roll = document.getElementById(roll_id);
		for (i=0; i<roll.length; i++)
		{
			if (roll.options[i].value == value)
			{
				index = i;
				break;
			}
		}
		roll.selectedIndex = index;
	}
	
	function ShowHideUrlSection(element, number)
	{
		if (element.checked)
		{
			document.getElementById('url_controller_' + number).style.display = '';
			document.getElementById('url_action_' + number).style.display = '';
			document.getElementById('url_id_' + number).style.display = '';		
		}
		else
		{
			document.getElementById('url_controller_' + number).style.display = 'none';
			document.getElementById('url_action_' + number).style.display = 'none';
			document.getElementById('url_id_' + number).style.display = 'none';
		}
	}
	
	
	/* DEPRICATED */
	
	function checkStdDir(elem)
	{
		if (elem.checked)
		{
			document.getElementById('std_id').checked = true;
			document.getElementById('std_name').checked = true;
			document.getElementById('std_description').checked = true;
		}
		else
		{
			document.getElementById('std_id').checked = false;
			document.getElementById('std_name').checked = false;
			document.getElementById('std_description').checked = false;		
		}
		
		checkStdId(document.getElementById('std_id'));
		checkStdName(document.getElementById('std_name'));
		checkStdDescription(document.getElementById('std_description'));
	}
	
	function checkStdId(elem)
	{
		if (elem.checked)
		{
			name = document.getElementById('name').value;
			
			changeSelectValue ('elements[0][type]', 'bigint');
			
			document.getElementById('elements[0][app_name]').value = 'id';		
			document.getElementById('elements[0][name]').value = name + '_id';		
			document.getElementById('elements[0][primary_key]').checked = true;		
			document.getElementById('elements[0][not_null]').checked = true;		
			
		}
		else
		{
			document.getElementById('std_dir').checked = false;		
			document.getElementById('elements[0][app_name]').value = '';		
		}
	}
	
	function checkStdName(elem)
	{
		if (elem.checked)
		{
			name = document.getElementById('name').value;
			
			changeSelectValue ('elements[1][type]', 'varchar');

			document.getElementById('elements[1][app_name]').value = 'name';
			document.getElementById('elements[1][name]').value = name + '_name';
			document.getElementById('elements[1][title]').value = 'LANG_TITLE';
			document.getElementById('elements[1][length]').value = '50';
			document.getElementById('elements[1][not_null]').checked = true;

		}
		else
		{
			document.getElementById('std_dir').checked = false;		
			document.getElementById('elements[1][app_name]').value = '';		
		}
	}
	function checkStdDescription(elem)
	{
		if (elem.checked)
		{
			name = document.getElementById('name').value;

			changeSelectValue ('elements[2][type]', 'text');
			
			document.getElementById('elements[2][app_name]').value = 'description';		
			document.getElementById('elements[2][name]').value = name + '_description';				
			document.getElementById('elements[2][title]').value = 'LANG_DESCRIPTION';
			document.getElementById('elements[2][not_null]').checked = false;

		}
		else
		{
			document.getElementById('elements[2][app_name]').value = '';		
			document.getElementById('std_dir').checked = false;
		}
	}